#include "FrameBuffer.cpp"
#include "PBuffer.cpp"

enum RenderTargetType{RTT_AUTO=0,RTT_COPY=1,RTT_PBUFFER=2,RTT_FRAMEBUFFER=3};

class RenderTarget
{
	RenderTargetType type;
	sFrameBuffer *fb;
	sPBuffer * pb;

	int width,height;
	int format,pformat;

	int msaa,bpp,bpc;

	int change;

	Texture *tex0; //main texture
	Texture *dtex; //depth texture
public:
	RenderTarget(RenderTargetType type);
	~RenderTarget();

	void Bind();
	void UnBind();

	void BindTexture(Texture *tex,int layer);
	void BindDepthTexture(Texture *tex);

	int Compile();

	void SetSize(int width,int height);
	void SetSize(int size);
	void SetMultisample(int msaa);
	void SetBPP(int bpp);
	void SetBPC(int bpc);

	void GetFormatFromTexture();
};